﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Web;

/// <summary>
/// Product 的摘要说明
/// </summary>
/// 

namespace MyTest
{
    /// <summary>
    /// Product 的摘要说明
    /// </summary>
    /// 
    public abstract class Product
    {
       //字段
        public string name; //产品名称
        public string price;//产品价格

        //属性
       public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public string Price
        {
            get { return price; }
            set { price = value; }
        }
       
        public Product() : this("")//无参构造函数
        {
            Debug.WriteLine("-=调用Product无参数构造方法=-");
           }

        public Product(string name)//有参构造函数
        {
            this.name = name;
            Debug.WriteLine("-=调用Product带参数构造方法=-");
        }

        /// <summary>
        /// 显示产品基本信息
        /// </summary>
        /// <returns></returns>
        public virtual string Show()
        {
            return "产品名称:" + this.name + ",产品价格：" + this.price;
        }

        /// <summary>
        /// 显示产品详细信息
        /// </summary>
        /// <returns></returns>
        public abstract string ShowDetail();


        ~Product()//析构函数
        {
            Debug.WriteLine("-=调用Product析构函数方法=-");
        }
    }
}
